#ifndef _SN_CONFIG_H
#define _SN_CONFIG_H

#include "basic.h"
#include "hardware_config.h"
#include "hal_config.h"

#define FLASH_MAGIC_VALUE  0x55 
#define FLASH_PAGE_SIZE 1024 //??
#define FLASH_PAGE_NUM  1 //1?



/**
 * @brief can总线地址 
 * 
 */
#define CAN_BROADCAST_ADDR          0x01      /*!< 广播地址*/  
#define CAN_MASTER_ADDR             0x03   /*!< 主机地址*/
#define CAN_MASTER_PROBE_ADDR       0x02   /*!< 主机探针地址*/


/**
 * @brief 主机下发的设置命令
 * 
 */
/*广播命令 配合广播地址使用*/
#define CAN_CMD_BROADCAST_HOST_SET_VOUT     0x0 /*!<主机广播设置电压 电流 */
#define CAN_CMD_BROADCAST_HOST_SET_IOUT     0x1 /*!<主机广播设置电流  */
#define CAN_CMD_BROADCAST_HOST_SET_DEV      0x2 /*!<主机广播设置开关机  */


/*单机命令*/
#define CAN_CMD_DEVICE_HOST_SET_VOUT               0x00    /*!< 设置电压 电流*/
#define CAN_CMD_DEVICE_HOST_SET_DEV_POWER          0x01    /*!< 设置开关机*/
#define CAN_CMD_DEVICE_HOST_GET_MOD_NUM            0x02
#define CAN_CMD_DEVICE_HOST_GET_MOD_STATUS         0x03
#define CAN_CMD_DEVICE_HOST_GET_MOD_AC_VOUT        0x04
#define CAN_CMD_DEVICE_HOST_GET_MOD_VOUT_IOUT      0x05


/*返回命令*/
#define  	CAN_CMD_SET_ADC_FACTOR    0xA1

#define CAN_TIMEOUT_VALUE 10  //10/2 5s


#define CAN_LIMIT_IOUT_BIT0 0     //限流
#define CAN_LIMIT_AVERAGE_BIT1 1 //均流

union ufloat_cons_t {
 float fval;
 char farray[4];
};

#endif // !_SN_CONFIG_H
